//
//  NSString+Size.m
//  KuBer
//
//  Created by 吴双 on 16/3/8.
//  Copyright © 2016年 huaxu. All rights reserved.
//

#import "NSString+Size.h"

@implementation NSString (Size)

- (CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize {
	return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:font} context:nil].size;
}
- (CGSize)sizeWithFontSizeFont:(UIFont*)fontSize maxSize:(CGSize)maxSize {
    return [self sizeWithFont:fontSize maxSize:maxSize];
}
- (CGFloat)getTextWidth:(CGFloat)height font:(UIFont*)fount {
    CGSize size = [self sizeWithFont:fount maxSize:CGSizeMake(MAXFLOAT, height)];
    return size.width;
}
- (CGSize)sizeWithFontSize:(CGFloat)fontSize maxSize:(CGSize)maxSize {
	return [self sizeWithFont:[UIFont systemFontOfSize:fontSize] maxSize:maxSize];
}
- (CGFloat)heightWithFont:(UIFont *)font maxWidth:(CGFloat)maxWidth {
    return [self sizeWithFont:font maxSize:CGSizeMake(maxWidth, MAXFLOAT)].height;
}
- (CGFloat)heightWithFontSize:(CGFloat)fontSize maxWidth:(CGFloat)maxWidth {
	return [self sizeWithFontSize:fontSize maxSize:CGSizeMake(maxWidth, MAXFLOAT)].height;
}

@end
